<template>
  <tr>
    <td><input type="checkbox" :checked="obj.checked" @click="$emit('change')"/></td>
    <td>{{ obj.name }}</td>
    <td>{{ obj.price }}</td>
    <td>
      <button @click="$emit('input',value+1)">+</button>
      {{ obj.num }} 
      <button :disabled="obj.num===0"
      @click="$emit('input',value-1)">-</button>
      </td>
    <td>{{ obj.num * obj.price }}</td>
    <td><a href="" @click.prevent="$emit('del',index)">删除</a></td>
  </tr>
</template>

<script>
export default {
  components: {},
  props: {
    obj: {
      type: Object,
      required: true,
    },
    value:{
      type : Number,
      required : true,
    },
    index:{
       type : Number,
      required : true,
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    fn() {
      console.log(1);
    },
  },
};
</script>

<style scoped></style>
